package thread.processing.performance;

import java.math.BigInteger;

public class Util {
	static void doWork() {
		// find the factorial of first 1000 numbers 10 times
		
		for (int i = 0; i < 10; i++) {
			for (int j = 1; j <= 1000; j++) {
				factorial(j);
			}
		}
		
			/*for (int j = 1; j <= 1000; j++) {
				factorial(j);
			}*/
		
	}
	static BigInteger factorial(long n) {
		if (n <= 1) {
			// 1
			return new BigInteger("1");
		} else {
			// n * factorial(n - 1)
			return BigInteger.valueOf(n).multiply(factorial(n - 1));
		}
	}
}
